var GameData = require('../module/gameData')();
cc.Class({
    extends: cc.Component,

    properties: {
        rope:cc.Node,

    },

    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        // var drawnode = cc.instantiate(GameData.GameLayer.drawNode);
        // this. rope = drawnode.getComponent(cc.Graphics);
        this.rope1 =  this.rope.getComponent(cc.Graphics);
        this.rope1.node.parent = GameData.GameLayer.node;
        this.rope1.node.zIndex=0;
    },
    drawline() {
        var pos1=GameData.GameLayer.cat.node.position;
        var pos2=this.node.position;
        var rope = this.rope1;
        rope.clear();
        rope.lineWidth = 5;
        rope.strokeColor = cc.color(0, 0, 0);
        rope.moveTo(pos1.x, pos1.y);
        rope.lineTo(pos2.x, pos2.y);
        rope.close();
        rope.stroke();
    },
    start() {

    },
    update(dt) {
        this.drawline();
    },
});
